package flc.ast.adapter;

import android.graphics.Color;
import android.graphics.PorterDuff;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.constraintlayout.utils.widget.ImageFilterView;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyVideoFilterBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.view.container.StkRelativeLayout;

public class VideoFilterAdapter extends StkProviderMultiAdapter<MyVideoFilterBean> {

    public VideoFilterAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(76));
        addItemProvider(new VideoFilterProvider());
    }

    private class VideoFilterProvider extends BaseItemProvider<MyVideoFilterBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_filter;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyVideoFilterBean bean) {
            baseViewHolder.setText(R.id.tvFilterItemName, bean.getFilterName());
            if (bean.isSelect()) {
                baseViewHolder.setImageResource(R.id.ivFilterItemImg, bean.getSelImg());
                baseViewHolder.setTextColor(R.id.tvFilterItemName, Color.parseColor("#000000"));
            } else {
                baseViewHolder.setImageResource(R.id.ivFilterItemImg, bean.getImg());
                baseViewHolder.setTextColor(R.id.tvFilterItemName, Color.parseColor("#949494"));
            }
        }
    }
}
